package com.sanyang.logistics.liuxu.handler;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sanyang.logistics.liuxu.dao.Hwdao;
import com.sanyang.logistics.pojo.Product;

@Controller
@RequestMapping("/hw")
public class Hwhandler {
    @Autowired
	private Hwdao dao;

    //查询
    @RequestMapping("/hwdas")
    @ResponseBody
    public Object hwdas(Product product) {
		List<Product> hwqueryAll = dao.hwqueryAll(product);
		System.out.println(hwqueryAll);
		return hwqueryAll;
	}
 
    //添加
    @RequestMapping("/hwinsert")
    @ResponseBody
    public Object hwinsert(Product product) {
		dao.hwinsert(product);
		System.out.println(product);
		return dao.hwqueryAll(product);
	}  
    
    //删除
    @RequestMapping("/hwdel")
    @ResponseBody
    public Object hwdel(Integer pid ,Product product) {
		dao.hwdel(pid);
		System.out.println(pid);
		return dao.hwqueryAll(product);
	}
    
    //修改拿值
    @RequestMapping("/hwxui")
    @ResponseBody
    public Object hwxui(Integer pid) {
		System.out.println(pid);
		return dao.hwxui(pid);
	}
    
    //修改
    @RequestMapping("/hwupdate")
    @ResponseBody
    public Object hwupdate(Product product) {
		System.out.println(product);
		dao.hwupdate(product);
		return dao.hwqueryAll(product);
	}
    
    
    
    
}
